home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / switcher / ldgrab.rexx < prev    next >
OS/2 REXX Batch file  |  1993-12-13  |  2KB  |  74 lines

  1. /* Grab frames on Sony LVR-3000N */
  2. /* Set serial at 9600 8N1, assume LD just turned on, did blank check */
  3. /* By Arnie Cachelin Mon Oct 19 16:00:02 1992 */
  4.  
  5. arg count name
  6.  
  7. cmd.0="56" /* All Clear */
  8. cmd.1="EC" /* Color Mode */
  9. cmd.2="EA" /* NTSC Mode */
  10. cmd.3="55" /* Frame # Mode */
  11. cmd.4="89" /* Field step Mode */
  12. /*cmd.4="88"  Frame step Mode */
  13. cmd.5="2B" /* Frame advance */
  14.  
  15. cmdnum=4
  16.  
  17. NextFrame=x2c("2B")
  18.  
  19. OPTIONS RESULTS
  20. TOASTERLIB="ToasterARexx.port"
  21.  
  22. if arg()=0 then do
  23.   say "USAGE: rx LDGrab <# of frames> <name>"
  24.   exit
  25. end
  26.  
  27. if count="" then count=10
  28. if count>1000 then count=1000
  29. if name="" then name=left(date(),6)
  30.  
  31. IF POS(TOASTERLIB , SHOW('Libraries')) = 0 THEN
  32.   IF ~ADDLIB(TOASTERLIB , 0) THEN x=Bummer(" Me No Find Toaster Library!")
  33.  
  34. if ~open(SerialOut,"SER:","a") then
  35.     do
  36.         say "Can't open serial port SER:."
  37.         exit
  38.     end
  39. else
  40.         do i=0 to cmdnum  /* Send setup commands */
  41.             s="command "i" Sent hex byte "cmd.i
  42.              writech(SerialOut,x2c(cmd.i))
  43.             say s
  44.         end
  45.  
  46. Switcher(TOSW)        /* Go to Switcher screen */
  47. Switcher(LVID)        /* Set to live digital video */
  48. time(reset)
  49. do f=0 to count
  50.   Switcher(FVID)      /* Freeze frame */
  51.   SaveNextFrame(name)
  52.   Switcher(LVID)      /* Set to live digital video */
  53.     writech(SerialOut,NextFrame)
  54.   address command
  55.   "wait 1 secs"
  56. end
  57.  
  58. Switcher(TOWB)        /* Go to Workbench screen */
  59.  
  60. exit
  61.  
  62. SaveNextFrame:  Procedure
  63.   arg name
  64.   N=Switcher(STAT,KNUM)       /* Get the current keypad number */
  65.   fs=N+1
  66.   do while Switcher(FMXI,fs) &fs~=N   /* Is the frame already there? */
  67.     if fs=999 then fs=0       /* wrap around at last frame */
  68.     else fs=fs+1
  69.   end
  70.   if fs=N then t=10        /* got to starting frame without finding open fs */
  71.   else t=Switcher(FMSV,fs,name)    /* Save frame */
  72.   say "Saved frame "name" in number "fs " at "time()
  73.   return t
  74.